package com.ysg.widget.dialog;

import android.content.Context;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.ysg.R;
import com.ysg.base.BaseDialog;

/**
 * vip特权
 */
public class VipPrivilegeDialog extends BaseDialog {
    private String type;

    public VipPrivilegeDialog(Context context, String type) {
        super(context);
        this.type = type;
    }

    private RelativeLayout rlBg;
    private TextView tvTitle, tvContent;
    private ImageView ivClose;

    @Override
    public int getLayoutId() {
        return R.layout.dialog_vip_privilege;
    }

    public void initView() {
        rlBg = findViewById(R.id.rlBg);
        tvTitle = findViewById(R.id.tvTitle);
        tvContent = findViewById(R.id.tvContent);
        ivClose = findViewById(R.id.ivClose);
    }


    @Override
    public void initData() {
        if (type.equals("1")){
            tvTitle.setText(getContext().getResources().getString(R.string.mine_vip_dialog_title1));
            tvContent.setText(getContext().getResources().getString(R.string.mine_vip_dialog_content1));
            rlBg.setBackgroundResource(R.mipmap.vip_dialog_icon3);
        }else if (type.equals("2")){
            tvTitle.setText(getContext().getResources().getString(R.string.mine_vip_dialog_title2));
            tvContent.setText(getContext().getResources().getString(R.string.mine_vip_dialog_content2));
            rlBg.setBackgroundResource(R.mipmap.vip_dialog_icon4);
        }else if (type.equals("3")){
            tvTitle.setText(getContext().getResources().getString(R.string.mine_vip_dialog_title3));
            tvContent.setText(getContext().getResources().getString(R.string.mine_vip_dialog_content3));
            rlBg.setBackgroundResource(R.mipmap.vip_dialog_icon2);
        }else if (type.equals("4")){
            tvTitle.setText(getContext().getResources().getString(R.string.mine_vip_dialog_title4));
            tvContent.setText(getContext().getResources().getString(R.string.mine_vip_dialog_content4));
            rlBg.setBackgroundResource(R.mipmap.vip_dialog_icon1);
        }else if (type.equals("5")){
            tvTitle.setText(getContext().getResources().getString(R.string.mine_vip_dialog_title5));
            tvContent.setText(getContext().getResources().getString(R.string.mine_vip_dialog_content5));
            rlBg.setBackgroundResource(R.mipmap.vip_dialog_icon5);
        }else {
            tvTitle.setText(getContext().getResources().getString(R.string.mine_vip_dialog_title6));
            tvContent.setText(getContext().getResources().getString(R.string.mine_vip_dialog_content6));
            rlBg.setBackgroundResource(R.mipmap.vip_dialog_icon6);
        }
    }

    @Override
    public void initListener() {
        ivClose.setOnClickListener((v)->{
            dismiss();
        });
    }

}
